Conditions | 2 |
Total Lines | 8 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { Strategy } from 'passport-http-bearer'; |
||
15 | |||
16 | public async validate(token: string): Promise<UserAuthView> { |
||
17 | const user = await this.userRepository.findOneByApiToken(token); |
||
18 | if (!user) { |
||
19 | throw new UnauthorizedException(); |
||
20 | } |
||
21 | |||
22 | return new UserAuthView(user.getId(), user.getRole()); |
||
23 | } |
||
25 |